Conversation
…allow ndarrays where flags.writeable is False
…his PR), rootconj_superop (important for this PR), plus partial_trace and trace_effect (nice to have but not strictly necessary for this PR).
…rket_trace to optools.py
|
Here's the most recent version of my CPTPInstrument which includes Corey's improvements to make it write to and load from disk: |
…g other than CPTPLND or GLND we raise a warning.
This reverts commit af57151.
…operations/cptrop.py. Add tests for those helper classes in test/unit/modelmembers/instruments.py. Move a TPInstrumentOp test class from test/unit/modelmembers/operations.py into the new test/unit/modelmembers/instrument.py. Docs for pygsti/modelmembers/instruments::cptp_instrument(...)
|
@rileyjmurray The notebook was shared because at one point you thought it would be useful to have the alternate CPTP Instrument approach documented here. I can't remember why right now. I would just ignore it, as none of the functionality is distinct from functionality already present in this PR. |
@pcwysoc, we had three reasons to be interested in your alternate implementation.
Given that info, do you still recommend we ignore that branch? In some just just the fact that we've had this conversion on the GitHub PRs serves as documentation in case we want to come back to this, but I figure I'd ask now. |
|
@rileyjmurray answers to your points:
|

This PR adds support for efficient Lindblad parameterizations of quantum instruments. Recall that our model of a quantum instrument is a collection of CPTR (completely positive trace reducing) maps that sum to a CPTP map.
The approach uses a Kraus-polar decomposition. Each CPTR map's Kraus operators are written as
K_i = U_i P_i^½, separating into a unitary part and a PSD part. From this point of view, a Kraus-rank-1 channelρ ↦ K_i ρ K_i^\\dagis a composition of a "root-conj" operatorρ ↦ (P_i^½) ρ (P_i^½)and a unitary channel. Enforcing the trace-preserving sum constraint then amounts to requiring that all PSD factors across all outcomes belong to a single valid POVM, which can be given any of pyGSTi's POVM parameterizations that ensure positivity. The unitaries can be promoted to noisy channels using any gate representation in pyGSTi.Core changes
Changes to
instruments/__init__.pykraus_polar_instrumentfunction. This is the main entry point to the new functionality.convertdelegates tokraus_polar_instrumentfor Lindblad target types.instrument_type_from_op_typeis now a trivial wrapper.Added a file,
modelmembers/operations/cptrop.py, that defines the following pair of linear operator classes used in kraus_polar_instrument.RootConjOperator: implements the mapρ ↦ E^½ ρ E^½, whereEis represented by aPOVMEffect. Its_repis recomputed viarootconj_superop()whenever parameters change. Parameters are shared with (and owned by) the underlying effect.SummedOperator: wraps a list ofLinearOperators and presents their superoperator sum as a single operator. Used when a CPTR map has Kraus rank > 1.Changes in
tools/optools.py.minimal_kraus_decomposition(op_x, op_basis, ...): returns the shortest list of Kraus operators for a CP superoperator by eigendecomposing its Choi matrix.rootconj_superop(effect_superket, basis, ...): computes the superoperator forρ ↦ E^½ ρ E^½given a superket representation ofE. Validates that eigenvalues ofElie in[0, 1].superket_trace(superket, basis): returnstr(ρ)given a superket representation ofρ; used inInstrument.actonto compute outcome probabilities correctly for non-PP bases.Demo notebook
Tutorials/objects/advanced/Instruments.ipynbhas been substantially revised to demonstrate the new CPTP parameterization alongside the existingTPInstrumentworkflow.modelpacks/_modelpack.py: extendcreate_gst_experiment_designto allow custom germs. This is useful for the demo notebook about GST with instruments.Tests
test/unit/modelmembers/test_instrument.py: coversInstrument,TPInstrument,RootConjOperator,SummedOperator, andkraus_polar_instrument. Includes round-trip checks (construct ->to_dense-> compare),from_vector/to_vectorconsistency, and basicactontests.test/unit/modelmembers/test_operation.py:TPInstrumentOptests moved fromtest_operation.pyto the newtest_instrument.py;test/unit/objects/test_instrument.pyremoved.Minor changes
SDPs and diamond distance
tools/sdptools.py: adds a new helper,solve_sdp(prob, ...), that wraps the solver-priority loop (MOSEK -> CLARABEL -> CVXOPT) for easy use in different contexts. Returns(objective_val, varvals_dict).diamonddistinoptools.pysimplified to callsolve_sdp.Almost entirely incidental
tools/exceptions.py: addedDubiousTargetWarningfor alerting users to unusual target specifications.modelmembers/states/cptpstate.py: minor formatting cleanup inderiv_wrt_params; removed ahessian_wrt_paramsoverride that was raisingNotImplementedErrorand is now handled by the base class.Kraus operators in LinearOperator classes.
modelmembers/operations/linearop.py: addedLinearOperator._kraus_operators()with a default implementation viaminimal_kraus_decomposition.modelmembers/operations/denseop.py: replaced the in-line implementation with delegation toLinearOperator._kraus_operators().